using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace CubicFWNet.Data.Models.Mapping
{
    public class NewsRecordMap : EntityTypeConfiguration<NewsRecord>
    {
        public NewsRecordMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.RealName)
                .HasMaxLength(64);

            this.Property(t => t.NewsName)
                .IsFixedLength()
                .HasMaxLength(10);

            // Table & Column Mappings
            this.ToTable("NewsRecord");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.NewsId).HasColumnName("NewsId");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.RealName).HasColumnName("RealName");
            this.Property(t => t.NewsName).HasColumnName("NewsName");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.Count).HasColumnName("Count");
        }
    }
}
